<%@ page language="java" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="s" uri="http://www.springframework.org/tags" %>
<%@ page isELIgnored="false" %>

<!DOCTYPE html>
<html>
  <head>
    <link rel="stylesheet" href="<s:url value="/resources"/>/css/innerstyle.css" type="text/css" />
    <link rel="stylesheet" type="text/css" media="screen" href="<s:url value="/resources"/>/css/custom-theme/jquery-ui.custom.min.css" />	
	<script type="text/javascript" src="<s:url value="/resources"/>/js/jquery-1.7.2.min.js"></script>
	<script type="text/javascript" src="<s:url value="/resources"/>/js/jquery-ui.custom.min.js"></script> 
	<script type="text/javascript" src="<s:url value="/resources"/>/js/i18n/jquery.ui.datepicker-zh-CN.js"></script>
	<script type="text/javascript" src="<s:url value="/resources"/>/js/jquery.form.js"></script>
	<script type="text/javascript" src="<s:url value="/resources"/>/js/json2.js"></script>
	<script type="text/javascript" src="<s:url value="/resources"/>/js/jquery.validate.min.js"></script>
	<script type="text/javascript" src="<s:url value="/resources"/>/js/messages_zh.js"></script>
<script type='text/javascript'>
$(function(){
             $("#but1").button();
             $("#but2").button();
             load();
             loadDzData();
        });
        
function save(){
    var parent=window.dialogArguments; 
    parent.document.getElementById("daozmc").value=$("#daozmc").val(); 
    parent.document.getElementById("daozbm").value=$("#daozid").val(); 
    parent.document.getElementById("zyx").value=$("#zyx").val(); 
    parent.document.getElementById("zzgid").value=$("#zzgid").val();
    parent.document.getElementById("zzgmc").value=$("#zzgmc").val();
    parent.document.getElementById("jxgid").value=$("#jxgid").val();
    parent.document.getElementById("jxgmc").value=$("#jxgmc").val(); 
    window.close();
}

function load(){
    var parent=window.dialogArguments;
    var daozmc =parent.document.getElementById("daozmc").value;
    var daozid =parent.document.getElementById("daozbm").value;
    var zyx =parent.document.getElementById("zyx").value;
    var zzgid =parent.document.getElementById("zzgid").value;
    var zzgmc =parent.document.getElementById("zzgmc").value;
    var jxgid =parent.document.getElementById("jxgid").value;
    var jxgmc =parent.document.getElementById("jxgmc").value;
    
    if(daozmc=="") return;
    //$("#daozid").append("<option value='"+daozid+"' selected>"+daozmc+"</option>");
       $("#daozid").val(daozid);
       $("#daozmc").val(daozmc);
    if(zyx!="")  
    $("#zyx").val(zyx);
    if(zzgmc!=""){
    $("#zzgid").append("<option value='"+zzgid+"' selected>"+zzgmc+"</option>");
       $("#zzgid").val(zzgid);
       $("#zzgmc").val(zzgmc);
    }
    if(jxgmc!=""){
    $("#jxgid").append("<option value='"+jxgid+"' selected>"+jxgmc+"</option>");
       $("#jxgid").val(jxgid);
       $("#jxgmc").val(jxgmc);
    }
}

//function changeTabForDaoz(){
 //   $( "#daozmc").val( $("#daozid").find("option:selected").text());
 //   }
 
 function changeTabForZzg(){
    $( "#zzgmc").val( $("#zzgid").find("option:selected").text());
    }
    
    function changeTabForJxg(){
    $( "#jxgmc").val( $("#jxgid").find("option:selected").text());
    }   
    

    function loadDzData(){
        $( "#daozmc").autocomplete({
 			minLength:2,
 			source:function( request, response ) {  
                 $.ajax({  
                     url: "<s:url value="/"/>/common/loadFz2",  
                     dataType: "json",  
                     data: {  
                         q: request.term  
                     },  
                     success: function( data ) {  

                     
                         response( $.map( data, function( item ) {  
                             return {  
                                 label: item.label,  
                                 value: item.value  
                             }  
                         }));  
                        
                     }  
                 });  
             },			
             select: function( event, ui ) {
 				$( "#daozmc").val( ui.item.label );							
 				$( "#daozid").val( ui.item.value );						
 				return false;

 			}
 		});
     }
</script>
  </head>
  
  <body>
    <table cellpadding="0" cellspacing="0" class="content">
	<tr>
	<td>到站：</td>
	<td algin="left">
	<!-- <div class="select"><div>
	   <select id="daozid" style="width:180px" onchange="changeTabForDaoz()">
            	<option value="-1" selected>==请选择==</option>
                   <c:forEach var="dz" items="${dzList}">
                   <option value="${dz.sysid}">
                   ${dz.mingch}
                   </option>
                   </c:forEach>
       </select>	
	</div></div>-->
	<input type="hidden" id="daozid">
	<input id="daozmc" name="daozmc" type="text"  title="请录入至少两个汉字关键字选择发站"/>
	</td>
	</tr>
	<tr>
	<td>专用线：</td>
	<td algin="left">
	<input type="text" id="zyx" class="longtextbox">
	</td>
	</tr>
	<tr>
	<td>中转港：</td>
	<td algin="left">
	<div class="select"><div>
	   <select id="zzgid" style="width:180px" onchange="changeTabForZzg()">
            	<option value="-1" selected>==请选择==</option>
                   <c:forEach var="zzg" items="${zzgList}">
                   <option value="${zzg.huanzgid}">
                   ${zzg.mingch}
                   </option>
                   </c:forEach>
       </select>	
	</div></div>
	<input type="hidden" id="zzgmc">
	</td>
	</tr>
	
	<tr>
	<td>接卸港：</td>
	<td algin="left">
	<div class="select"><div>
	   <select id="jxgid" style="width:180px" onchange="changeTabForJxg()">
            	<option value="-1" selected>==请选择==</option>
                   <c:forEach var="jxg" items="${jxgList}">
                   <option value="${jxg.zhongdid}">
                   ${jxg.mingch}
                   </option>
                   </c:forEach>
       </select>	
	</div></div>
	<input type="hidden" id="jxgmc">
	</td>
	</tr>	
	<tr>
		    <td>    
		    &nbsp;
		    </td>		    
            <td align="right"> 
            <input id="but1" type="button" name="" value="确认" onclick="save();"/>&nbsp;&nbsp;           
		    <input id="but2" type="button" name="" value="关闭" onclick="window.close();"/>
            </td>           
        </tr>
        <tr>
        <td colspan="2">
        <br>
               <span style="color: red;vertical-align:middle;">
               特别说明：近期由于最新IE11升级更新包（KB3008923）会导致发站、到站、品种质量指标等弹出窗口无法点击返回，解决办法：
请即时升级最新的补丁包（<a href="http://support.microsoft.com/kb/3025390">点击下载KB3025390</a> ）。
               </span>
        </td>
      </tr>
	</table>	
	
  </body>
</html>
